﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Automapping.Alterations;
using ADIGRE.Domain;
using FluentNHibernate.Mapping;
using FluentNHibernate.Automapping;

namespace ADIGRE.Infrastructure.NHibernateMaps
{
    public class LancamentoMap : IAutoMappingOverride<Lancamento>
    {
        public void Override(AutoMapping<Lancamento> mapping)
        {
            mapping.DiscriminateSubClassesOnColumn(typeof(EnumLancamento).Name).Not.Nullable()
                .SubClass<Entrada>(e =>
                    e.References(x => x.Receita)
                )
                .SubClass<Saida>(e =>
                    e.References(x => x.Despesa)
                );
        }
    }
}
